/*-
 * Copyright (c) 2007 Microsoft
 * All rights reserved.
 */

#pragma once

namespace Microsoft{
    namespace ComputeCluster{
        namespace MpiNet{
            ref class TypeMapper
            {
            private:
                TypeMapper()
                {
                }

                static System::Collections::Hashtable^ typetable;
                static TypeMapper()
                {
                    typetable = gcnew System::Collections::Hashtable();

                    typetable->Add(Char::typeid, MPI_WCHAR);
                    typetable->Add(Byte::typeid, MPI_BYTE);
                    typetable->Add(Int16::typeid, MPI_SHORT);
                    typetable->Add(UInt16::typeid, MPI_UNSIGNED_SHORT);
                    typetable->Add(Int32::typeid, MPI_INT);
                    typetable->Add(Int64::typeid, MPI_LONG_LONG);
                    typetable->Add(UInt64::typeid, MPI_UNSIGNED_LONG);
                    typetable->Add(UInt32::typeid, MPI_UNSIGNED);


                    typetable->Add(Single::typeid, MPI_FLOAT);
                    typetable->Add(Double::typeid, MPI_DOUBLE);
                }


            internal:
                static int Get(Type^ t)
                {
                    return (int)typetable->default::get(t);
                }
            };
        }
    }
}